import request from "@/api/request";
import type { AxiosResponse } from "axios";

export type GetNoticeParams = {
  announce_type: number | string,
  page: number,
  page_size: number
}
export function getNotice(params: GetNoticeParams): Promise<AxiosResponse> {
  return request('announce/query_announces', params, 'post')
}

export type CreateNoticeParams = {
  en_title: string,
  en_content: string,
  pt_title: string,
  pt_content: string,
  announce_type: number,
  announce_start: number,
  announce_end: number,
  announce_status: number
}
export function createNotice(params: CreateNoticeParams): Promise<AxiosResponse> {
  return request('announce/create_announce', params, 'post')
}

export type UpdateNoticeParams = {
  announce_id: number,
  en_title: string,
  en_content: string,
  pt_title: string,
  pt_content: string,
  announce_type: number,
  announce_start: number,
  announce_end: number,
  announce_status: number
}
export function updateNotice(params: UpdateNoticeParams): Promise<AxiosResponse> {
  return request('announce/update_announce', params, 'post')
}

export type DeleteNoticeParams = {
  announce_id: number
}
export function deleteNotice(params: DeleteNoticeParams): Promise<AxiosResponse> {
  return request('announce/delete_announce', params, 'post')
}
